#include<stdio.h>
 #include<unistd.h>
 int main()
 {
   int ret = fork();
 
     if(ret==0)
     {
       while(1)
       {
         printf("子进程pid %d ppid %d",getpid(),getppid());
         sleep(1);
       }
     }
     else if(ret>0)
     {
       while(1)
       {
         printf("父进程pid %d ppid %d",getpid(),getppid());
         sleep(1);
       }
     }
   return 0;
 }
   
